//
//  MKCustomTopicBtn.m
//  singForYou
//
//  Created by nicolas on 2017/7/25.
//  Copyright © 2017年 nicolas. All rights reserved.
//

#import "MKCustomTopicBtn.h"

@implementation MKCustomTopicBtn

#pragma mark - Init

- (instancetype)initWithFrame:(CGRect)frame Target:(id)target Action:(SEL)action ForControlEvents:(UIControlEvents)controlEvents Image:(NSString *)normalImage {
    
    self = [super initWithFrame:frame];
    
    if (self) {
        
//        [self setBackgroundImage:[self createImageWithColor:[UIColor whiteColor]] forState:UIControlStateNormal];
//        [self setBackgroundImage:[self createImageWithColor:[UIColor redColor]] forState:UIControlStateSelected];
        [self.imageView setImage:[UIImage imageNamed:normalImage]];
        [self.titleLabel setTextColor:[UIColor redColor]];
        [self.titleLabel setFont:[UIFont systemFontOfSize:15]];
    }

    return self;
    
}

- (void)rollBack {
    
    
    
}

- (UIImage *)createImageWithColor:(UIColor *)color {
    
    CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    UIImage *colorImg = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return colorImg;
}

- (void)setCurrentAnswerLbl:(NSString *)currentAnswerLbl {
    
    _currentAnswerLbl = currentAnswerLbl;
    
    [self.titleLabel setText:currentAnswerLbl];
    
}

- (void)setNormalImage:(UIImage *)normalImage {
    
    _normalImage = normalImage;
    
}

@end
